


using Mengsk.ProxyDelivery.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mengsk.ProxyDelivery.Service
{
    public class SellerWithdrawalService : ServiceBase<SellerWithdrawal>
    {
        const string APIURL_REVIEW = "/webservice/sellerwithdrawal/review.html";

        const string APIURL_COMPLELTE = "/webservice/sellerwithdrawal/complete.html";

        public DataCollection<SellerWithdrawal> GetByAll(int sellerId, string op, string comment, SellerWithdrawsState state, DateTime startCreateTime, DateTime endCreateTime, int pageIndex, int pageSize)
        {
            Request req = new Request { Api = "getByAll" };
            req.Add("sellerId", sellerId);
            req.Add("op", op);
            req.Add("comment", comment);
            req.Add("state", state);
            req.Add("startCreateTime", startCreateTime);
            req.Add("endCreateTime", endCreateTime);
            req.Add("pageIndex", pageIndex);
            req.Add("pageSize", pageSize);
            return this.DoRemoteCall<SellerWithdrawal>(req).ToDataCollection();
        }

        public void Review(int id, int sellerId, bool accept, string comment)
        {
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("id", id.ToString());
            dic.Add("sellerId", sellerId.ToString());
            dic.Add("accept", accept.ToString());
            dic.Add("comment", comment);
            this.DoPost<int>(APIURL_REVIEW, dic);
        }

        public void Complete(int id, int sellerId, string comment, bool success)
        {
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("id", id.ToString());
            dic.Add("sellerId", sellerId.ToString());
            dic.Add("success", success.ToString());
            dic.Add("comment", comment.ToString());
            this.DoPost<int>(APIURL_COMPLELTE, dic);
        }
    }
}
